package com.zq.recruit.controller;

import com.zq.common.util.Result;
import com.zq.recruit.dao.entity.Interview;
import com.zq.recruit.service.InterviewService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

/**
 * @Author 张乔
 * @Date 2025/4/5 21:33
 */
@RestController
@RequestMapping("/recruit/interview")
public class InterviewController {


    @Resource
    private InterviewService interviewService;


    @PostMapping("/add")
    public Result<Object>  add(@RequestBody Interview interview){
        interview.setCreateTime(new Date());
        interview.setUpdateTime(new Date());
        interviewService.getExistId(interview);
        interviewService.save(interview);
        return Result.success();
    }


    @GetMapping("/getInfoByUserId/{userId}")
    public Result<Object>  getInfoByUserId(@PathVariable("userId") Integer userId){
    List<Interview> list= interviewService.getInfoByUserId(userId);
        return Result.successData(list);
    }

    @GetMapping("/getAllInfo")
    public Result<Object>  getAllInfo(){
        List<Interview> list= interviewService.getAllInfo();
        return Result.successData(list);
    }





}
